//
// Created by jsjxsy on 2022/9/1.
//
#include <vector>
#include <iostream>
using namespace std;
int main() {
  vector<int> v1;
  v1 = {1, 2, 3, 4, 5};
  v1.begin();
  for (vector<int>::iterator it = v1.begin(); it != v1.end(); it++) {
    cout << *it << " ";
  }
  cout << endl;

  vector<int> v2(v1);
  v2.push_back(6);
  v2.push_back(7);
  while (!v2.empty()) {
    cout << v2.back() << " ";
    v2.pop_back();
  }
  cout << endl;
  cout << "v2 size:" << v2.size() << endl;

  vector<int> v3(v1);
  v3.push_back(6);
  v3.push_back(7);
  while (!v3.empty()) {
    cout << v3.front() << " ";
    v3.erase(v3.begin());
  }
  cout << endl;
  cout << "v3 size:" << v3.size() << endl;

  vector<int> v4(v1);
  vector<int>::iterator it = v4.begin();
  while (it != v4.end()) {
    cout << *it << " ";
    it++;
  }
  cout << endl;
  return 0;
}
